package genosAgape.conexao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {
       public final static String URL = "jdbc:postgresql://localhost:5432/genos_agape";
       public final static String PASSWORD = "1029384756";
       public final static String USER = "postgres";
       public final static String JDBC_DRIVER = "org.postgresql.Driver"; 
       
       public static Connection getConnection() throws Exception,SQLException{
               try{
                       Class.forName(JDBC_DRIVER);
                       return DriverManager.getConnection(URL,USER,PASSWORD);
               }catch(ClassNotFoundException e){
                       throw new ClassNotFoundException("Driver nao encontrado.");
               }catch(SQLException e){
                       throw new SQLException("Erro de SQL no banco");
               }
       }
}